import 'package:flutter_bloc/flutter_bloc.dart';

class CounterCubit extends Cubit<int> {
  CounterCubit() : super(0);
  void increment() => emit(state + 1);

  @override
  void onChange(Change<int> change) {
    addError(Exception('increment error!'), StackTrace.current);
    super.onChange(change);
    print("内部---1---change---$change");
  }

  @override
  void onError(Object error, StackTrace stackTrace) {
    // TODO: implement onError
    print(error);
    super.onError(error, stackTrace);
  }
}
